<!--_meta 作为公共模版分离出去-->
<!DOCTYPE HTML>
<html>
<head>
	<meta charset="utf-8">
	<meta name="renderer" content="webkit|ie-comp|ie-stand">
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
	<meta http-equiv="Cache-Control" content="no-siteapp" />
	<link rel="Bookmark" href="favicon.ico" >
	<link rel="Shortcut Icon" href="favicon.ico" />
	<!--[if lt IE 9]>
	<script type="text/javascript" src="lib/html5.js"></script>
	<script type="text/javascript" src="lib/respond.min.js"></script>
	<![endif]-->
	<link rel="stylesheet" type="text/css" href="static/h-ui/css/H-ui.min.css" />
	<link rel="stylesheet" type="text/css" href="static/h-ui.admin.pro/css/h-ui.admin.pro.css" />
	<link rel="stylesheet" type="text/css" href="lib/Hui-iconfont/1.0.9/iconfont.css" />
	<link rel="stylesheet" type="text/css" href="static/business/css/style.css" />
	<!--[if IE 6]>
	<script type="text/javascript" src="http://lib.h-ui.net/DD_belatedPNG_0.0.8a-min.js" ></script>
	<script>DD_belatedPNG.fix('*');</script><![endif]-->
	<!--/meta 作为公共模版分离出去-->

	<title>新增公告</title>
	<link href="lib/webuploader/0.1.5/webuploader.css" rel="stylesheet" type="text/css" />
</head>
<body>
	<article class="Hui-admin-page-container">
		<form class="form form-horizontal" id="form-article-add">
			<div class="row clearfix">
				<label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>公告内容：</label>
				<div class="form-controls col-xs-8 col-sm-9">
					<textarea name="content" id="content" cols="" rows="" class="textarea textarea-picture"  placeholder="请输入公告内容"></textarea>
				</div>
			</div>
			<div class="row clearfix">
				<label class="form-label col-xs-4 col-sm-2"><span class="c-red"></span>公告类别：</label>
				<div class="form-controls col-xs-8 col-sm-9">
					<select id="type" name="type">
						<option value="0">持久公告</option>
						<option value="1">临时公告</option>
					</select>
				</div>
			</div>
			<div class="row clearfix">
				<div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-2">
					<button class="btn btn-primary radius" type="button" id="noticeAddBtn"><i class="Hui-iconfont">&#xe632;</i> 发布</button>
					<button onClick="layer_close();" class="btn btn-default radius" type="button">&nbsp;&nbsp;取消&nbsp;&nbsp;</button>
				</div>
			</div>
		</form>
	</article>

	<!--_footer 作为公共模版分离出去-->
	<script type="text/javascript" src="lib/jquery/1.9.1/jquery.min.js"></script>
	<script type="text/javascript" src="lib/layer/3.1.1/layer.js"></script>
	<script type="text/javascript" src="static/h-ui/js/H-ui.js"></script>
	<script type="text/javascript" src="static/h-ui.admin.pro/js/h-ui.admin.pro.js"></script>
	<!--/_footer /作为公共模版分离出去-->

	
	<script type="text/javascript" src="lib/jquery.validation/1.14.0/jquery.validate.js"></script>
	<script type="text/javascript" src="lib/jquery.validation/1.14.0/validate-methods.js"></script>
	<script type="text/javascript" src="lib/jquery.validation/1.14.0/messages_zh.js"></script>
	<script type="text/javascript" src="static/business/js/main2.js"></script>
	<script type="text/javascript">
	function layer_close(){
		var index = parent.layer.getFrameIndex(window.name);
		parent.layer.close(index);
	}
		$(function(){
			getMenu();

			// 2. 点击发布按钮事件
			$("#noticeAddBtn").click(function () {
				// 检查内容是否为空
			    var content =	$("#content").val();
			    var type = $("#type").val();
			    if(content.length<=0){
			    	alert("公告内容不能为空");
			    	return;
				}
			    var data = {"content":content, "type":type};
				$.ajax({
					method:"post",
					url:"notice?action=addNotice",
					data:data,
					success:function (result){
						console.log(result);
						alert(result.msg);
						if(result.code == 20002){
							location.href="/login.html";
						}else {
							location.href="/dormitory-statistical.html";
						}
					}
				});
			})
		});
	</script>
</body>
</html>
